package com.kygeng.springframework.context.support;

import com.kygeng.springframework.beans.BeansException;
import com.kygeng.springframework.beans.factory.support.DefaultListableBeanFactory;
import com.kygeng.springframework.beans.factory.xml.XmlBeanDefinitionReader;

/**
 * @Title: AbstractXmlApplicationContext
 * @Author: kygeng
 * @Package: com.kygeng.springframework.context.support
 * @Date: 2024/7/22 13:42
 * @Description: 配置信息的加载
 */
public abstract class AbstractXmlApplicationContext extends AbstractRefreshableApplicationContext {

    @Override
    protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws BeansException {
        XmlBeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(beanFactory, this);
        String[] configLocations = getConfigLocations();
        if (null != configLocations) {
            beanDefinitionReader.loadBeanDefinitions(configLocations);
        }
    }

    protected abstract String[] getConfigLocations();

}
